package com.levy.contronller.lamdaTest;

import java.util.function.DoubleToIntFunction;
import java.util.function.Function;

public class FunctionTest {


    public static void main(String[] args) {
        FunctionTest functionTest = new FunctionTest();
        System.out.println(functionTest.compute(5, value -> value + 2));
        System.out.println(functionTest.compute(5, o -> {
            return o * o;
        }));


        Function<Integer, Integer> function = value -> value + 2;
        System.out.println(functionTest.compute(5, function));
    }


    public int compute(int a, Function<Integer, Integer> function) {
        Integer apply = function.apply(a);
        return apply;
    }
}
